<template>
  <div class="subpage">
    <scroll-view
        :scroll-y="true"
        :scroll-x="false"
        style="height:100%;"
        @scrolltolower="scroll"
        >
      <div class="bg_index">
        <img :src="bgUrl" alt="" class="bgImg" />
        <img :src="logoUrl" alt="" class="logoImg" />
      </div>
      <div class="content">
        <div class="btnContent">
          <button
            @click="bindGetUserInfo"

          >
            <p><img :src="text_icon" alt="" class="icon" /></p>
            <p class="title">线上问诊</p>
          </button>
          <button
            @click="bindGetUserInfo2"
          >
            <p><img :src="prescriptIcon" alt="" class="icon" /></p>
            <p class="title">开药专区</p>
          </button>
          <button  @click="bindGetUserInfo3" >
            <p><img :src="yun_icon" alt="" class="icon" /></p>
            <p class="title">云诊间</p>
            <span class="unSolveOrder" v-if="orderCount>0" >{{orderCount}}</span>
          </button>
        </div>
        <div class="btnContent">
          <button
            @click="toAILead"
          >
            <p><img :src="ailead" alt="" class="icon" /></p>
            <p class="title">智能导诊</p>
          </button>
          <button open-type="getUserInfo"  @getuserinfo="toLiveVideo">
            <p><img :src="liveVideo" alt="" class="icon" /></p>
            <p class="title">健康教育</p>
          </button>
          <button open-type="getUserInfo"  @getuserinfo="GetLoginStatus">
            <p><img :src="personbtn" alt="" class="icon" /></p>
            <p class="title">个人中心</p>
          </button>
        </div>
        <scroll-view class="scroll-view_H" scroll-x>
          <view
            v-for="(item, index) in docList"
            :key="index"
            @click="toDoctorDetails(item)"
            :class="['scroll-view-item_H', 'doc_card', {'firstView':index===0}]"
          >
            <div class="card_content">
              <div>
                <image
                  :src="item.doctor_image_url"
                  alt=""
                  class="doc_img"
                  mode="aspectFill"
                ></image>
              </div>
              <div class="doc_content">
                <p class="doc_name">{{ item.doctor_name }}</p>
                <p class="doc_dept">{{ item.dept_name }}</p>
                <p class="doc_per">
                  <img :src="lingdaiImg" alt="" />
                  {{ item.title }}
                </p>
              </div>
            </div>
          </view>
        </scroll-view>
        <!-- </div> -->
        <div class="bottomBanner">
          <h3 @click="showBackMoal" >最新新闻</h3>
          <ul>
            <li v-for="item in newsList" @click="goLastedNews(item.url)" :key="item.id">
              <image :src="item.image_id" @load="loadSuccess" :webp="true" style="width: 100%;height:466rpx" />
              <span>{{item.title}}</span>
            </li>
            <!-- <li>
              <image :src="prevent_bg4" mode="widthFix" style="width: 100%;" />
              <span>50岁！她再当妈！</span>
            </li>
            <li>
              <image :src="prevent_bg5" mode="widthFix" style="width: 100%;" />
              <span>8厘米小切口，心脏换瓣手术不用“大开胸”</span>
            </li> -->
          </ul>
        </div>
      </div>
      <button class="cus_button" plain="true" open-type="contact" @contact="handleContact" :session-from="sessionFrom">
        <img :src="cusserver" alt="">
      </button>
    </scroll-view>
    <div class="modal" v-if="showUnpay">
        <div class="out">
            <div class="top" >
                <span>您有待处理的诊疗订单，请尽快处理</span>
            </div>
            <div class="btm">
                <span @click='showUnpay = false'>暂不处理</span>
                <span>
                  <button class="dealBtn" open-type="getUserInfo" @getuserinfo="goPrescription" >去处理</button>
                </span>
            </div>
        </div>
    </div>
    <div class="modal" v-if="backModal">
        <div class="out">
            <div class="top" >
                <span>是否退出登录?</span>
            </div>
            <div class="btm">
                <span @click="backModal = false">取消</span>
                <span>
                  <button class="dealBtn"  @click="goBackLogin" >确认</button>
                </span>
            </div>
        </div>
    </div>
    <i-message id="message" />
  </div>
</template>
<script>
import nim from '@/utils/nim'
import api from '@/api/api'
import cssRing from '@/components/cssRing'
let app = getApp()
const { $Toast, $Message } = require('../../../static/iview/base/index')
export default {
  components: {
    cssRing
  },
  data () {
    return {
      imgUrl: '',
      newsPage: 1,
      logoUrl: '',
      textList: [],
      docList: [],
      tipList: [
        {
          title: '戴口罩',
          content: '保护自己，对他人负责'
        },
        {
          title: '勤洗手',
          content: '用流动水洗手至少15秒'
        },
        {
          title: '不扎堆',
          content: '不去人群聚集的地方'
        },
        {
          title: '拒聚餐',
          content: '不串门，不聚餐'
        },
        {
          title: '常通风',
          content: '适时通风，注意保暖'
        },
        {
          title: '吃熟食',
          content: '生熟分开，食物煮熟'
        },
        {
          title: '早就医',
          content: '出现发热、乏力、咳嗽，及时就医'
        },
        {
          title: '禁野味',
          content: '不食用野生动物'
        },
        {
          title: '莫轻视',
          content: '人群普遍易感，不要轻视'
        }
      ],
      bgUrl: '',
      bgBottomUrl: '',
      prevent_bg4: '',
      prevent_bg3: '',
      prevent_bg5: '',
      area: '',
      timer: null,
      lingdaiImg: '',
      expert_icon: '',
      video_icon: '',
      prescriptIcon: '',
      text_icon: '',
      yun_icon: '',
      flag: true,
      personbtn: '',
      cusserver: '',
      ailead: '',
      soonsee: '',
      liveVideo: '',
      orderCount: 0,
      newsList: [],
      showUnpay: false,
      loginTimes: 0,
      backModal: false,
      sessionFrom: ''
    }
  },
  onUnload () {
    // clearInterval(this.timer);
    this.timer = null
    this.flag = true
    this.newsPage = 1
  },
  onLoad () {
    this.timer = null
    this.imgUrl = api.imgUrl
    this.bgUrl = this.imgUrl + 'wd_bg2.png'
    this.expert_icon = this.imgUrl + 'expert_icon.png'
    this.video_icon = this.imgUrl + 'video_icon.png'
    this.text_icon = this.imgUrl + 'text_icon.png'
    this.logoUrl = this.imgUrl + 'wd_logo.png'
    this.prescriptIcon = this.imgUrl + 'prescriptArea.png'
    this.bgBottomUrl = this.imgUrl + 'bg2.png'
    this.yun_icon = this.imgUrl + 'yun_icon1.png'
    this.prevent_bg5 = this.imgUrl + 'prevent_bg5.png'
    this.lingdaiImg = this.imgUrl + 'lingdai.png'
    this.prevent_bg4 = this.imgUrl + 'prevent_bg4.png'
    this.prevent_bg3 = this.imgUrl + 'prevent_bg3.png'
    this.personbtn = this.imgUrl + 'personbtn.png'
    this.cusserver = this.imgUrl + 'cusserver1.png'
    this.ailead = this.imgUrl + 'ailead.png'
    this.soonsee = this.imgUrl + 'soonsee.png'
    this.liveVideo = this.imgUrl + 'liveVideo.png'
    this.newsPage = 1
    // 获取微信胶囊信息 保存本地给自定义头部组件
    let menuButtonObject = wx.getMenuButtonBoundingClientRect()
    this.$storage.setNavBarInfo(menuButtonObject)
    this.getNewsList()
    this.getNonPayment()
    wx.showShareMenu({
      withShareTicket: true,
      menus: ['shareAppMessage', 'shareTimeline']
    })
  },
  onShow () {
    // this.$storage.setToken('eyJhbGciOiJIUzUxMiIsImlhdCI6MTYxMjQ5NTIwOCwiZXhwIjoxNjE1MDg3MjA4fQ.eyJ1c2VyX2lkIjo3NjcxMywidXNlcl90eXBlIjoiMSIsIm9yaWdpbiI6bnVsbH0.FObwVZZkzMHsPL8HPbyqVb-7ncS4LDevUv8M5GgmN0BBr3gz3vzzenGUZ4b791xAVDUvHl1ti8Fxe9mNj7J5lQ')
    this.orderCount = 0
    this.orderAliveCount()
    this.showUnpay = false
    this.backModal = false
    this.getUserList()
  },
  mounted () {
    if (!this.getToken) {this.nimLogin()}
    let reConnect
    mpvue.onNetworkStatusChange(function (res) {
      console.log(
        res.networkType + (res.isConnected ? '网络正常' : '网络中断')
      )
      if (reConnect) {
        clearInterval(reConnect)
      }
      if (!res.isConnected) {
        nim.destroy()
        // wx.showLoading({
        //   title: '重连中...',
        //   mask: true
        // })
        reConnect = setInterval(function () {
          console.log('重连', 'nim.reconnection()')
          nim.reconnection()
        }, 2000)
      } else {
        wx.hideLoading()
        console.log('清除手动重连定时任务', 'nim.reconnection()')
        let pages = getCurrentPages()
        let currentPage = pages[pages.length - 1]
        let currentPage2 = pages[pages.length - 2]
        // 视频的时候切换  导致重连 再次点击挂断视频  患者端接受不到
        if (
          currentPage.route.includes('videoCall') === true ||
          currentPage2.route.includes('videoCall') === true
        ) {
          return
        }
        nim.destroy({
          done: function () {
            nim.reconnection()
            reConnect = null
          }
        })
      }
    })
    // this.getSetting()
  },
  methods: {
    handleContact (e) {
      let info = this.$storage.getAccountInfo()
      this.sessionFrom = `nickName=${info.patient_name}|avatarUrl=${info.head_portrait}`
      console.log(e)
    },
    nimLogin () {
      let that = this
      var token = this.$storage.getToken()
      if (token) {
        that.$api.get_user_info('', { showLoading: true }).then(function (res) {
          let accountInfo = res.data[0]
          that.sessionFrom = `nickName=${accountInfo.patient_name}|avatarUrl=${accountInfo.head_portrait}`
          if (accountInfo.netease_token) {
            nim.login(accountInfo)
          }
        })
      }
    },
    // 跳转登入
    showBackMoal () {
      this.loginTimes++
      if (this.loginTimes > 5) {
        this.backModal = true
      }
      setTimeout(() => {
        this.loginTimes = 0
      }, 2000)
    },
    // 隐藏推出登录
    goBackLogin () {
      this.$utils.showToast('text', '请稍候...')
      this.$storage.setToken(null)
      setTimeout(() => {
        this.$router.push('/pages/center/child/login/main')
      }, 300)
    },
    // 跳转 健康直播
    toLiveVideo (e) {
      let that = this
      if (e.mp.detail.rawData) {
        //用户按了允许授权按钮
        console.log('用户按了允许授权按钮')
        //判断是否登陆(是否有患者token)
        var token = this.$storage.getToken()
        if (token) {
          //判断是否认证
          that.$api
            .get_user_info('', { showLoading: true })
            .then(function (data) {
              let accountInfo = data.data[0]
              accountInfo.headImg = data.data[0].head_portrait
                ? data.data[0].head_portrait
                : ''
              that.$storage.setAccountInfo(accountInfo)
              if (accountInfo.netease_token) {
                nim.login(accountInfo)
              }
              if (data.data[0].isreal == 0) {
                // '未认证' 去认证
                that.$router.push('/pages/qualification/main')
              } else if (data.data[0].isreal == 1) {
                // '已认证'
                that.$router.push('/pages/subPage/liveVideoArea/liveHomepage/main')
              }
            })
        } else {
          //跳转登录页
          // console.log('用户未登录')
          let that = this
          mpvue.login({
            success (res) {
              if (res.code) {
                that.$utils.showToast('text', '请先登录')
                setTimeout(() => {
                  that.$router.push('/pages/center/child/login/main')
                }, 500)
                return
                that.$api.wechatLogin({ code: res.code }).then((data) => {
                  that.openid = data.data.openid
                  that.key = data.data.session_key
                  if (data.data.token) {
                    that.$storage.setToken(data.data.token)
                    that.$router.push('/pages/subPage/register/liveVideo/main')
                  } else {
                    that.$router.push('/pages/center/child/login/main')
                  }
                })
              } else {
                that.$router.push('/pages/center/child/login/main')
                // console.log('用户未登录')
              }
            }
          })
        }
      } else {
        //用户按了拒绝按钮
        console.log('用户按了拒绝按钮')
      }
    },
    // 判断是否有未支付的诊疗订单
    getNonPayment () {
      if (this.$storage.getToken()) {
        this.$api.prescriptionNonPayment({}, {showloading: false}).then(res => {
          this.showUnpay = res.data == '1'
        })
      }
    },
    // 跳转诊疗订单
    goPrescription (e) {
      if (e.mp.detail.rawData) {
        //用户按了允许授权按钮
        console.log('用户按了允许授权按钮')
        //判断是否登陆(是否有患者token)
        var token = this.$storage.getToken()
        if (token) {
          //判断是否认证
          var that = this
          that.$api
            .get_user_info('', { showLoading: true })
            .then(function (data) {
              let accountInfo = data.data[0]
              accountInfo.headImg = data.data[0].head_portrait
                ? data.data[0].head_portrait
                : ''
              that.$storage.setAccountInfo(accountInfo)
              if (accountInfo.netease_token) {
                nim.login(accountInfo)
              }
              if (data.data[0].isreal == 0) {
                // '未认证' 去认证
                that.$router.push('/pages/qualification/main')
              } else if (data.data[0].isreal == 1) {
                // '已认证' 去挂号
                that.$router.push('/pages/center/child/prescriptionOrder/main')
              }
            })
        } else {
          //跳转登录页
          // console.log('用户未登录')
          let that = this
          mpvue.login({
            success (res) {
              if (res.code) {
                that.$api.wechatLogin({ code: res.code }).then((data) => {
                  that.openid = data.data.openid
                  that.key = data.data.session_key
                  if (data.data.token) {
                    that.$storage.setToken(data.data.token)
                    that.$router.push('/pages/center/child/prescriptionOrder/main')
                  } else {
                    that.$router.push('/pages/center/child/login/main')
                  }
                })
              } else {
                that.$router.push('/pages/center/child/login/main')
                // console.log('用户未登录')
              }
            }
          })
        }
      } else {
        //用户按了拒绝按钮
        console.log('用户按了拒绝按钮')
      }
    },
    // 获取网络状态
    getNetwordStatus () {
      wx.getNetworkType({
        success (res) {
          const networkType = res.networkType
          if (networkType == '2g' || networkType == 'none') {
            $Message({
              content: '您当前网络状态不佳',
              type: 'warning'
            })
          }
        }
      })
      wx.onNetworkStatusChange(function (res) {
        console.log(res.isConnected)
        if (!res.isConnected) {
          $Message({
            content: '您当前网络状态不佳',
            type: 'warning'
          })
        }
      })
    },
    // 获取当前患者活跃的订单数
    orderAliveCount () {
      if (this.$storage.getToken()) {
        this.$api.orderAliveCount({}, {showLoading: false}).then(res => {
          this.orderCount = res.data
        })
      }
    },
    toDept () {
      this.$router.push('/pages/subPage/register/dept/main')
    },
    toserver (e) {
      let that = this
      if (e.mp.detail.rawData) {
        //用户按了允许授权按钮
        console.log('用户按了允许授权按钮')
        //判断是否登陆(是否有患者token)
        var token = this.$storage.getToken()
        console.log(token, 'token')
        if (token) {
          //判断是否认证
          that.$api
            .get_user_info('', { showLoading: true })
            .then(function (data) {
              let accountInfo = data.data[0]
              accountInfo.headImg = data.data[0].head_portrait
                ? data.data[0].head_portrait
                : ''
              that.$storage.setAccountInfo(accountInfo)
              if (accountInfo.netease_token) {
                nim.login(accountInfo)
              }
              if (data.data[0].isreal == 0) {
                // '未认证' 去认证
                that.$router.push('/pages/qualification/main')
              } else if (data.data[0].isreal == 1) {
                // '已认证'
                that.$router.push('/pages/subPage/register/server/main')
              }
            })
        } else {
          //跳转登录页
          mpvue.login({
            success (res) {
              if (res.code) {
                that.$utils.showToast('text', '请先登录')
                setTimeout(() => {
                  that.$router.push('/pages/center/child/login/main')
                }, 500)
                return
                that.$api.wechatLogin({ code: res.code }).then((data) => {
                  that.openid = data.data.openid
                  that.key = data.data.session_key
                  if (data.data.token) {
                    that.$storage.setToken(data.data.token)
                    that.$router.push('/pages/subPage/register/server/main')
                  } else {
                    that.$router.push('/pages/center/child/login/main')
                  }
                })
              } else {
                that.$router.push('/pages/center/child/login/main')
                // console.log('用户未登录')
              }
            }
          })
        }
      } else {
        //用户按了拒绝按钮
        console.log('用户按了拒绝按钮')
      }
    },
    getUserList () {
      // doctor_list
      var that = this
      that.$api.doctor_list('', { showLoading: true }).then(function (res) {
        that.docList = res.data
      })
    },
    // 横向滚动医生信息点击跳转
    toDoctorDetails (item) {
      var token = this.$storage.getToken()
      if (token) {
        this.$router.push(`/pages/subPage/register/doctorDetails/main?id=${item.doctor_id}&name=${item.doctor_name}&canShowModal=true`)
      } else {
        this.$utils.showToast('text', '请先登录')
        setTimeout(() => {
          this.$router.push('/pages/center/child/login/main')
        }, 300)

      }
    },
    getUserInfo13 (e) {
      this.$router.push(`/pages/subPage/register/consultationRoom/main`)
    },
    getUserInfo12 (e) {
      if (wx.canIUse('button.open-type.getUserInfo')) {
        // 用户版本可用
      } else {
        // console.log('请升级微信版本')
      }
    },
    getUserInfo1 (e) {
      // 判断小程序的API，回调，参数，组件等是否在当前版本可用。  为false 提醒用户升级微信版本
      // console.log(wx.canIUse('button.open-type.getUserInfo'))
      if (wx.canIUse('button.open-type.getUserInfo')) {
        // 用户版本可用
        //  this.$router.push("/pages/subPage/register/dept/main")
      } else {
        // console.log('请升级微信版本')
      }
    },
    GetLoginStatus (e) {
      // 个人中心
      let that = this
      if (that.flag == true) {
        that.flag = false
      } else {
        return
      }
      that.flag = true
      if (e.mp.detail.rawData) {
        let obj = JSON.parse(e.mp.detail.rawData)
        that.$storage.setWxInfo(obj)
        //用户按了允许授权按钮
        //判断是否登陆(是否有患者token)
        var token = that.$storage.getToken()
        if (token) {
          //判断是否认证
          that.$api
            .get_user_info('', { showLoading: true })
            .then(function (data) {
              let accountInfo = data.data[0]
              accountInfo.headImg = data.data[0].head_portrait
                ? data.data[0].head_portrait
                : ''
              that.$storage.setAccountInfo(accountInfo)
              that.$router.push('/pages/center/main')

            })
        } else {
          //跳转登录页
          mpvue.login({
            success (res) {
              if (res.code) {
                that.$utils.showToast('text', '请先登录')
                setTimeout(() => {
                  that.$router.push('/pages/center/child/login/main')
                }, 500)
                return
                that.$api.wechatLogin({ code: res.code }).then((data) => {
                  that.openid = data.data.openid
                  that.key = data.data.session_key
                  if (data.data.token) {
                    // that.$storage.setToken(data.data.token);
                    that.$router.push('/pages/center/main')

                  } else {
                    that.$router.push('/pages/center/child/login/main')
                  }
                })
              } else {
                that.$router.push('/pages/center/child/login/main')
                // console.log('用户未登录')
              }
            }
          })
        }
      } else {
        //用户按了拒绝按钮
        console.log('用户按了拒绝按钮')
      }
    },
    bindGetUserInfo2 (e) {
      //  去开药专区
      this.$router.push('/pages/subPage/register/prescriptArea/choosePage/main')
      return
      if (e.mp.detail.rawData) {
        //用户按了允许授权按钮
        console.log('用户按了允许授权按钮')
        //判断是否登陆(是否有患者token)
        var token = this.$storage.getToken()
        if (token) {
          //判断是否认证
          var that = this
          that.$api
            .get_user_info('', { showLoading: true })
            .then(function (data) {
              let accountInfo = data.data[0]
              accountInfo.headImg = data.data[0].head_portrait
                ? data.data[0].head_portrait
                : ''
              that.$storage.setAccountInfo(accountInfo)
              if (accountInfo.netease_token) {
                nim.login(accountInfo)
              }
              if (data.data[0].isreal == 0) {
                // '未认证' 去认证
                that.$router.push('/pages/qualification/main')
              } else if (data.data[0].isreal == 1) {
                // '已认证' 去挂号
                // that.$router.push("/pages/subPage/register/dept/main");
                that.$router.push(
                  `/pages/subPage/register/dept/main?video=${0}`
                )
              }
            })
        } else {
          //跳转登录页
          // console.log('用户未登录')
          let that = this
          mpvue.login({
            success (res) {
              if (res.code) {
                that.$api.wechatLogin({ code: res.code }).then((data) => {
                  that.openid = data.data.openid
                  that.key = data.data.session_key
                  if (data.data.token) {
                    that.$storage.setToken(data.data.token)
                    // that.$router.push("/pages/subPage/register/dept/main");
                    that.$router.push(
                      `/pages/subPage/register/dept/main?video=${0}`
                    )
                  } else {
                    that.$router.push('/pages/center/child/login/main')
                  }
                })
              } else {
                this.$router.push('/pages/center/child/login/main')
                // console.log('用户未登录')
              }
            }
          })
        }
      } else {
        //用户按了拒绝按钮
        console.log('用户按了拒绝按钮')
      }
    },
    bindGetUserInfo3 (e) {
      // 进入云诊间
      this.$router.push(
        `/pages/subPage/register/consultationRoom/main`
      )
      return
      if (e.mp.detail.rawData) {
        //用户按了允许授权按钮
        console.log('用户按了允许授权按钮')
        //判断是否登陆(是否有患者token)
        var token = this.$storage.getToken()
        if (token) {
          //判断是否认证
          var that = this
          that.$api
            .get_user_info('', { showLoading: true })
            .then(function (data) {
              let accountInfo = data.data[0]
              accountInfo.headImg = data.data[0].head_portrait
                ? data.data[0].head_portrait
                : ''
              that.$storage.setAccountInfo(accountInfo)
              if (accountInfo.netease_token) {
                nim.login(accountInfo)
              }
              if (data.data[0].isreal == 0) {
                // '未认证' 去认证
                that.$router.push('/pages/qualification/main')
              } else if (data.data[0].isreal == 1) {
                // '已认证' 去云诊间
                // that.$router.push("/pages/subPage/register/dept/main");
                that.$router.push(
                  `/pages/subPage/register/consultationRoom/main`
                )
              }
            })
        } else {
          //跳转登录页
          // console.log('用户未登录')
          let that = this
          mpvue.login({
            success (res) {
              if (res.code) {
                that.$api.wechatLogin({ code: res.code }).then((data) => {
                  that.openid = data.data.openid
                  that.key = data.data.session_key
                  if (data.data.token) {
                    that.$storage.setToken(data.data.token)
                    // that.$router.push("/pages/subPage/register/dept/main");
                    that.$router.push(
                      `/pages/subPage/register/consultationRoom/main`
                    )
                  } else {
                    that.$router.push('/pages/center/child/login/main')
                  }
                })
              } else {
                this.$router.push('/pages/center/child/login/main')
                // console.log('用户未登录')
              }
            }
          })
        }
      } else {
        //用户按了拒绝按钮
        console.log('用户按了拒绝按钮')
      }
    },
    bindGetUserInfo (e) {

      // 去线上问诊
      this.$router.push(
        `/pages/subPage/register/dept/main?video=${1}`
      )

      return
      if (e.mp.detail.rawData) {
        //用户按了允许授权按钮
        console.log('用户按了允许授权按钮')
        //判断是否登陆(是否有患者token)
        var token = this.$storage.getToken()
        if (token) {
          //判断是否认证
          var that = this
          that.$api
            .get_user_info('', { showLoading: true })
            .then(function (data) {
              let accountInfo = data.data[0]
              accountInfo.headImg = data.data[0].head_portrait
                ? data.data[0].head_portrait
                : ''
              that.$storage.setAccountInfo(accountInfo)
              if (accountInfo.netease_token) {
                nim.login(accountInfo)
              }
              if (data.data[0].isreal == 0) {
                // '未认证' 去认证
                that.$router.push('/pages/qualification/main')
              } else if (data.data[0].isreal == 1) {
                // '已认证' 去挂号
                that.$router.push(
                  `/pages/subPage/register/dept/main?video=${1}`
                )
              }
            })
        } else {
          //跳转登录页
          // console.log('用户未登录')
          let that = this
          mpvue.login({
            success (res) {
              if (res.code) {
                that.$api.wechatLogin({ code: res.code }).then((data) => {
                  that.openid = data.data.openid
                  that.key = data.data.session_key
                  if (data.data.token) {
                    that.$storage.setToken(data.data.token)
                    that.$router.push('/pages/subPage/register/dept/main')
                  } else {
                    that.$router.push('/pages/center/child/login/main')
                  }
                })
              } else {
                this.$router.push('/pages/center/child/login/main')
                // console.log('用户未登录')
              }
            }
          })
        }
      } else {
        //用户按了拒绝按钮
        console.log('用户按了拒绝按钮')
      }
    },
    getSetting () {
    },
    toAILead () {
      wx.navigateToMiniProgram({
        appId: 'wx9a540b5057985f00',
        path: '/pages/index?appid=d564c705897195cf9b5cfc354ac725835cc5f40970363c37a190c954a5330bb3'
      })
    },
    getNewsList () {
      let count = this.newsPage * 3
      this.$api.getIndexNewsList({count: 3}, { showLoading: false }).then(res => {
        this.newsList = res.data
      })
    },
    loadSuccess () {
      console.log('图片加载完成')
    },
    scroll () {
      // this.newsPage ++;
      // this.getNewsList()
      console.log(this.newsPage)
    },
    goLastedNews (url) {
      this.$router.push(`/pages/subPage/register/webView/main?news=1&newsUrl=${url}`)
    }
  }
}
</script>
<style scoped lang="less">
.subpage {
  width: 100%;
  height: 100%;
  // overflow-y: scroll;
  box-sizing: border-box;
}
.bg_index {
  width: 100%;
  height: 420rpx;
  position: relative;
  .bgImg {
    width: 100%;
    height: 360rpx;
  }
  .logoImg {
    position: absolute;
    left: 0;
    right: 0;
    top: -100rpx;
    bottom: 0;
    margin: auto;
    width: 656rpx;
    height: 118rpx;
  }
}
.content {
  position: relative;
  margin-top: -60rpx;
  .btnContent {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    margin: 10rpx 0;
    button {
      position: relative;
      background-color: #fff;
      border: 0;
    }
    .unSolveOrder {
      position: absolute;
      height: 36rpx;
      min-width: 36rpx;
      background:linear-gradient(315deg,rgba(255,51,50,1) 0%,rgba(255,111,145,1) 100%);
      top: 0rpx;
      right: 8rpx;
      border-radius: 18rpx;
      color: #fff;
      font-size: 22rpx;
      line-height: 36rpx;
      padding: 0 4rpx;
      box-sizing: border-box;
    }
    button::after {
      border: 0;
    }
    img {
      width: 145rpx;
      height: 145rpx;
    }
    .title {
      font-size: 32rpx;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: rgba(73, 98, 232, 1);
      line-height: 52rpx;
      text-align: center;
    }
    .tip {
      font-size: 24rpx;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: rgba(102, 102, 102, 1);
      line-height: 36rpx;
      text-align: center;
    }
  }
  .notice_content {
    margin: auto;
    width: 690rpx;
    height: 195rpx;
    padding: 23rpx 0;
    // position: absolute;
    // top: -100rpx;
    overflow: hidden;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.13);
    border-radius: 16rpx;
    // background-color: red;
    // margin-top: -100rpx;
    box-sizing: border-box;
  }

  // }

  .dia_button {
    width: 620rpx;
    height: 90rpx;
    margin: 30rpx auto;
    transform: translateZ(0);
    background: linear-gradient(
      90deg,
      rgba(85, 125, 245, 1) 0%,
      rgba(63, 74, 222, 1) 100%
    );
    border-radius: 50px;
    font-size: 36rpx;
    text-align: center;
    line-height: 90rpx;
    color: #fff;
    font-family: PingFangSC-Regular, PingFang SC;
  }
  .tex_tip {
    width: 698rpx;
    margin: 0 auto;
    font-size: 26rpx;
  }
  .head_text {
    font-size: 32rpx;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: rgba(51, 51, 51, 1);
    line-height: 45rpx;
    margin-left: 30rpx;
    margin-top: 20rpx;
    .bq {
      width: 32rpx;
      height: 32rpx;
      margin-right: 20rpx;
      vertical-align: text-bottom;
    }
  }

  .scroll-view_H {
    white-space: nowrap;
    overflow: hidden;
  }
  .scroll-view-item_H {
    width: 315rpx;
    height: 160rpx;
  }
}
.doc_card {
  display: inline-block;
  width: 310rpx;
  height: 160rpx;
  background: rgba(255, 255, 255, 1);
  box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, 0.08);
  border-radius: 17rpx;
  border: 1px solid rgba(238, 238, 238, 1);
  margin: 30rpx 15rpx;
  .card_content {
    width: 315rpx;
    height: 160rpx;
    display: flex;
    // justify-content: center;
    padding-left: 15rpx;
    flex-direction: row;
    align-items: center;
    .doc_img {
      width: 100rpx;
      height: 100rpx;
      border-radius: 50%;
      margin-right: 30rpx;
    }
    .doc_content {
      width: 170rpx;
      .doc_name {
        font-size: 28rpx;
        font-weight: 600;
        color: rgba(51, 51, 51, 1);
        line-height: 40rpx;
      }
      .doc_dept {
        font-size: 22rpx;
        font-weight: 400;
        color: rgba(153, 153, 153, 1);
        // width: 200rpx;
        line-height: 40rpx;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      .doc_per {
        // width:146rpx;
        height: 34rpx;
        background: rgba(231, 238, 254, 1);
        border-radius: 30rpx;
        font-size: 22rpx;
        color: rgba(51, 51, 51, 1);
        line-height: 34rpx;
        padding: 5rpx 12rpx;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        max-width: 72px;
        display: inline-block;
        img {
          width: 24rpx;
          height: 24rpx;
          display: inline-block;
          vertical-align: text-bottom;
        }
      }
    }
  }
}
.firstView {
  margin-left: 30rpx;
}
.prize-item {
  // width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 20rpx;
  // height: 50rpx;
  box-sizing: border-box;
  .list-reward {
    font-size: 26rpx;
    color: rgba(153, 153, 153, 1);
    // line-height:37rpx;
  }
  .list-name {
    font-size: 26rpx;
  }
}
.listShow {
  width: 100%;
  // height: ;
  li {
    line-height: 56rpx;
  }
}
swiper {
  height: 81px !important;
  overflow: hidden !important;
}
image {
  display: block;
}
.cus_button{
  position: fixed;
  right: 18rpx;
  top: 185rpx;
  width: 154rpx;
  height: 170rpx;
  border: 0;
  padding: 0;
  img{
    width: 154rpx;
    height: 170rpx;
  }
}
.bottomBanner {
  padding: 0 25rpx;
  margin-bottom: 20rpx;
  color: #333;
  h3 {
    padding-top: 10rpx;
    font-weight: 700;
  }
  ul {
    width: 100%;
    li {
      position: relative;
      display: block;
      margin-top: 30rpx;
      border-radius: 10rpx;
      overflow: hidden;
      span {
        position: absolute;
        height: 85rpx;
        line-height: 85rpx;
        padding-left: 22rpx;
        bottom: 0rpx;
        width: 100%;
        font-size: 32rpx;
        font-weight: 500;
        overflow: hidden;
        box-sizing: border-box;
        background-color: rgba(255, 255, 255, .7);
        text-overflow:ellipsis;
        white-space:nowrap;
      }
    }
  }
}
.person_button {
  position: fixed;
  right: 30rpx;
  bottom: 120rpx;
  width: 113rpx;
  height: 113rpx;
  button {
    padding-left: 0 !important;
    padding-right: 0 !important;
    line-height: 36rpx;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 28rpx;
    width: 113rpx;
    height: 113rpx;
    border-radius: 50%;
    text-align: center;
    background: linear-gradient(
      129deg,
      rgba(85, 125, 245, 1) 0%,
      rgba(63, 74, 222, 1) 100%
    );
    font-weight: 500;
    color: rgba(255, 255, 255, 1);
    letter-spacing: 1px;
    box-sizing: border-box;
  }
}
.modal {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    background: rgba(0,0,0,.7);
    opacity: 1;
    z-index: 100;
    .out {
      height: 412rpx;
      border-radius: 6rpx;
      width: 650rpx;
      background: #fff;
      z-index: 999;
      position: absolute;
      left: 50%;
      top: 50%;
      margin-top: -206rpx;
      margin-left: -325rpx;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      .top {
        flex: 1;
        padding: 110rpx 48rpx 0 48rpx;
        text-align: center;
        span {
          font-size: 34rpx;
          font-family:PingFangSC-Regular,PingFangSC;
          font-weight:400;
          line-height:48rpx;
        }
      }
      .btm {
        height: 100rpx;
        line-height: 100rpx;
        display: flex;
        font-size:34rpx;
        font-family:PingFangSC-Regular,PingFangSC;
        font-weight:400;
        .sure {
          background:#4A64EA;
          color: #fff;
        }
        span {
          flex: 1;
          text-align: center;
        }
        span:nth-child(1) {
          background: #f9f9f9;
        }
        span:nth-child(2),.dealBtn {
          background:#4A64EA;
          color: #fff;
        }
        .dealBtn {
          height: 100%;
          width: 100%;
          border-radius: 0rpx!important;
        }
      }
    }
}
</style>
